@svizzle/utils/string-[array-array]

Methods

(static) pluckPath(path) → {function}

Source:
Since:
  • 0.16.0
See:

Return a function expecting an array of objects and plucking the provided array with the input path

Example
> getABs = pluckPath('a.b')
> getABs([{a: {b: -1, label: 'foo'}}, {a: {b: 4, label: 'bar'}}])
[-1, 4]
> getABs([{a: {label: 'foo'}}, {a: {b: 2}}])
[undefined, 2]
Parameters:
Name Type Description
path string
Returns:
  • String -> (Array -> Array)
Type
function